home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 6.8 KB | 211 lines |
- ' ************************************* Commands used:
- ' * * Imploder Load Blitter Clear
- ' * Amcaf Examples * Pt Cia Speed Turbo Draw
- ' * Protracker Commands V1.2 * Pt Volume Blitter Fill
- ' * Written by Chris Hodges * Pt Voice =Lsstr$
- ' * * Pt Play =Lsr
- ' ************************************* =Pt Vu
- '
- ' Hide the mouse cursor, because we need sprite 0.
- Hide
- ' Load some music. 4 Spirits is a tune by Alexander Kunz. Thx for it! :)
- ' Music must be loaded into chipmem, so the banknumber has to be negativ.
- ' The music file has been file imploded to save a mere 72 KB of valuable
- ' disk space.
- Extension_8_0EA2 "Data/mod.4spirits",-3
- '�Open a 4 colours screen.
- Screen Open 0,320,256,4,Lowres
- Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
- ' Copy the sprite palette to the right place.
- Get Sprite Palette
- For A=0 To 15 : Colour A+16,Colour(A) : Next
- ' Set screen palette
- Palette $8,$FFF,$8,$FF8
- ' Turn on double buffering.
- Double Buffer
- Autoback 1
- ' Create a nice copper bar.
- Set Rainbow 0,1,64,"","",""
- For A=0 To 63
- Rain(0,A)=Max(Min(A/3-8,15),0)*$10+Min(A/2,15)*$100+Max(Min(A/2-15,15),0)
- Next
- Rainbow 0,0,Y Hard(191),64
- ' Dim a field to hold the current vumeter state.
- Dim VU(3)
- ' Another field is needed for some boring text.
- Dim TXT$(13)
- ' TXT$() is filled now filled with text.
- For A=1 To 13
- Read TXT$(A)
- Next
- ' Print the speed counter. =Lsstr$ is used to make a formatted string.
- BPM=125
- Pen 1 : Locate 0,16 : Print "Current speed: "; Extension_8_0EC8(BPM,3)+" bpm."
- Print "To change use cursor left/right."
- ' Print the volume control-text.
- VOL=64
- Pen 1 : Locate 0,19 : Print "Current volume: "; Extension_8_0EC8(VOL,2)
- Print "To change press cursor up/down."
- ' Print toggles. To keep it as simple as possible, I reserve a field which
- ' holds the two channel states (on or off), and then look, if the bit
- ' is set in the channel mask.
- Dim TG$(1)
- TG$(0)="Off" : TG$(1)="On "
- VOI=%1111
- For C=0 To 3
- Locate 0,8+C : Print "Channel";C+1;": "+TG$( Extension_8_093A(VOI,C) and 1)
- Next
- Print : Print "Press 1,2,3,4 to toggle channels."
- ' Now follow some sprite definitions for the drums.
- ' Sorry, but I'm not a graphic artist, and I do apologize the low-quality
- ' Sprites :)
- HITHIHAT$="(1,1)(2,1)(1,1)(3,1)(1,2)(2,2)(1,3)(3,3)(1,1)"
- OPENHIHAT$="(4,3)(5,3)(1,1)"
- HITBASS$="(12,3)(13,3)(14,3)(11,3)"
- HITSNARE$="(15,3)(16,3)(17,3)(11,3)"
- HITBOTH$="(18,3)(19,3)(20,3)(11,3)"
- CLAP$="(7,1)(8,1)(9,1)(10,1)(6,1)"
- ' Now display the sprites and assign them to the channels.
- Sprite 0,X Hard(112),Y Hard(64),1
- Channel 0 To Sprite 0
- Sprite 2,X Hard(128),Y Hard(64),11
- Channel 1 To Sprite 2
- Sprite 6,X Hard(176),Y Hard(64),6
- Channel 2 To Sprite 6
- ' Set the music to cia-timing.
- Extension_8_10F2 BPM
- ' Turn up the volume to maximum.
- Extension_8_10C6 VOL
- ' Turn on all voices.
- Extension_8_10D6 VOI
- ' And finally, start playing.
- Extension_8_108E 3
- Repeat
- ' Print out the current song and pattern position:
- Pen 1
- Locate 0,5 : Print "Song Pos :"; Extension_8_15DE
- Print "Pattern Pos:"; Extension_8_15F0 ;" "
- ' Print the instruments and their frequencies
- Pen 1
- For A=0 To 3
- Locate A*10+1,22 : Print Hex$( Extension_8_15FE(A),2); Extension_8_160E(A)/1000;"KHz "
- Next
- ' Check the keyboard.
- I$=Inkey$
- ' Check for the keys 1 to 4.
- If I$=>"1" and I$<="4"
- ' Get the channelnumber. I don't use the Val-Function, because it does not
- ' work correctly when compiled.
- C=Asc(I$)-Asc("1")
- ' Change the bit C in the voice mask.
- Bchg C,VOI
- Pen 1
- Locate 0,8+C : Print "Channel";C+1;": "+TG$( Extension_8_093A(VOI,C) and 1)
- Extension_8_10D6 VOI
- End If
- ' Has cursor-down been pressed?
- If I$=Cdown$ and VOL>0
- ' Then make it softer.
- Dec VOL
- Pen 1 : Locate 16,19 : Print Extension_8_0EC8(VOL,2)
- Extension_8_10C6 VOL
- End If
- ' Has cursor-up been pressed?
- If I$=Cup$ and VOL<64
- ' Then make it louder.
- Inc VOL
- Pen 1 : Locate 16,19 : Print Extension_8_0EC8(VOL,2)
- Extension_8_10C6 VOL
- End If
- ' Has cursor-left been pressed?
- If I$=Cleft$ and BPM>32
- ' Then decrement speed.
- Dec BPM
- Pen 1 : Locate 15,16 : Print Extension_8_0EC8(BPM,3)
- Extension_8_10F2 BPM
- End If
- ' Has cursor-right been pressed?
- If I$=Cright$ and BPM<255
- ' Then increase speed.
- Inc BPM
- Pen 1 : Locate 15,16 : Print Extension_8_0EC8(BPM,3)
- Extension_8_10F2 BPM
- End If
- ' Clear the old vumeters from the screen.
- Extension_8_1234 0,0,16,190 To 304,256
- For A=0 To 3
- ' Look if there's a new note.
- VU= Extension_8_10E6(A)
- ' Yes? Then set the vumeter to the new value
- If VU Then VU(A)=VU
- ' Draw two horizontal lines. the vertical lines are not needed.
- Extension_8_1016 A*80+24+VU(A)/4,255-VU(A) To A*80+24+VU(A)/8,255,1
- Extension_8_1016 A*80+57-VU(A)/4,255-VU(A) To A*80+57-VU(A)/8,255,1
- ' Decrement the height of the vumeter bar.
- VU(A)=Max(VU(A)-2,0)
- Next
- ' Fill the four vumeters.
- Extension_8_1066 0,0,16,190,304,256
- ' Look if some event has occured.
- P= Extension_8_10B6
- ' Yes? Then examine the signal.
- If P
- ' Print the value, and fade it out.
- Home : Pen 2 : Print "Pt Signal: ";Hex$(P,2)
- Colour 2,$FF0
- Fade 4,$8,$FFF,$8
- ' If the signal is from 1 to 16, it will be used to print out some text.
- If P<16
- Pen 3 : Locate 0,3 : Cline : Print TXT$(P)
- End If
- ' Is it in the range from 16 to 32, it represents one of the drums.
- If P>15 and P<32
- ' Hit the hihat, when signal 16,18 or 20 appeared.
- If P=16 or P=18 or P=20
- Anim 0,HITHIHAT$ : Anim On 0
- End If
- ' Open it, if signal 17 was sent.
- If P=17
- Anim 0,OPENHIHAT$ : Anim On 0
- End If
- ' Bassdrum on 18 and 20
- If P=18 or P=20
- Anim 1,HITBASS$ : Anim On 1
- End If
- ' Snaredrum on 21
- If P=21
- Anim 1,HITSNARE$ : Anim On 1
- End If
- ' And both snare and bass on 22
- If P=22
- Anim 1,HITBOTH$ : Anim On 1
- End If
- ' Clap hands when signal is 19 or 20.
- If P=19 or P=20
- Anim 2,CLAP$ : Anim On 2
- End If
- End If
- End If
- ' Swap screens.
- Screen Swap
- Wait Vbl
- Until I$=Chr$(27) or Mouse Key
- Extension_8_10A8
- Amal Off
- Sprite Off
- Screen Close 0
- Rainbow Del : View : Wait Vbl
- End
- Data "Yeah!!!"
- Data "These are AMCAF..."
- Data "Protracker commands..."
- Data "The text appears..."
- Data "in perfect synchro with the music!"
- Data "You can control all your effects..."
- Data "directly from within the music! Cool!"
- Data "Dumdidum... :)))"
- Data "Just watch the vumeters... "
- Data "And enjoy the music..."
- Data "Music by Neurodancer/Abyss."
- Data "Sorry, but I'm too lazy to fill in..."
- Data "some more commands. Fin!"